package it.bifulco.luigi.jemotion.core;

import it.bifulco.luigi.jemotion.core.exception.ConnectException;

/**
 * VideoConnector interface to expose connect and disconnect operation A video
 * connector is responsible to connect to a source of video data. More
 * specifically a video connector is used to obtain the stream of images
 * serialized from a video source.
 * 
 * The Frame is the type of image obtained by the video source
 * 
 * @author Luigi
 * 
 */
public interface VideoConnector<Frame extends VideoFrame> {

	/**
	 * starts a new connection to the specified destination and return a
	 * connection id
	 * 
	 * @param destination
	 * @return
	 * @throws ConnectException
	 */
	public String connect(String destination) throws ConnectException;

	/**
	 * return true if and only if the connectionId was existent and the
	 * connection was disconnected clearly
	 * 
	 * @param connectionId
	 * @return
	 */
	public boolean disconnect(String connectionId);

	/**
	 * After the connection was started the stream can be read. This method is
	 * invoked every time a new frame is obtained and converted in a processable
	 * frame from the stream.
	 * 
	 * * @param videoFrame
	 */
	public void onNewVideoFrame(Frame videoFrame);

}
